# -*- coding: utf-8 -*-
# @Time : 2024/5/7 13:56
# @Author : Zxg
# @Email : 1473858993@qq.com
# @File : checksheetpage_two.py
# @Project : Luckin_coffee_Api
from selenium.webdriver.common.by import By

from common.basepage import BasePage
from utils.mysql_util import mysql_method


class Check_Sheet_Page_Two(BasePage):
    # 切换iframe1
    iframe_ele_one = '/132/reimbursement-edit?popType=edit&parentName=%E5%AF%B9%E5%85%AC%E4%BB%98%E6%AC%BE&kidName=%E5%AF%B9%E5%85%AC%E4%BB%98%E6%AC%BE%E6%B5%8B%E8%AF%95&reportId=549219&tabTitle=%E6%8A%A5%E8%B4%A6%E5%8D%95-%E4%BF%AE%E6%94%B9&repeatJump=true&isPathComponent=false&manyTab=true&fromRouteName=codeChild132'
    # 切换iframe2
    iframe_ele_two = 'invoiceIframe'
    # 发票上传定位
    push_invoice = By.XPATH, '/html/body/div/div/div/div[2]/div/div/div[1]/div/div/div/div/button[1]/span'
    # 选择文件定位
    select_file = By.XPATH, '/html/body/div[1]/div/div/div[2]/div/div/div[3]/div/div[2]/div[2]/div/button/span'

    def check_sheet_page_two(self):
        # 执行sql语句进行解绑发票 - 48214573
        mysql_method().excute_query('lucky_fi',
                                    "update  t_income_invoice_base_info  set  is_delete=1  WHERE  invoice_num = '48214573'  and is_delete=0 and biz_code is not null;")
        print('1')



        # 切换iframe
        self.switch_to_frame(self.iframe_ele_one)
        print(2)
        # 切换iframe
        self.switch_to_frame(self.iframe_ele_two)
        print(3)
        # 点击上传发票
        self.click(self.push_invoice)
        print(4)
        # 点击选择文件
        self.click(self.select_file)
        print(5)
